﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Views.AilPay
{
    public partial class SucceedPay : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                ResultCommand();
        }
        protected void ResultCommand()
        {
            string[] meg = { Request.QueryString["payInterface"], Request.QueryString["money"], Request.QueryString["NetPayMent"], Request.QueryString["DB"] };

            if (string.IsNullOrEmpty(meg[1]))//monery为空时显示“0元”
                lblMoney.Text = "0 元";
            else
                lblMoney.Text = meg[1] + " 元";


            if (meg[2] != "true" || meg[3] != "true")//支付状态和数据库写入其中一个不成功时
            {
                if (meg[2] == "true" && meg[3] != "true")//当支付成功时
                {
                    lblNetPayMent.Text = "网上支付成功,写入数据库失败。";
                    lblSM.Text = "钱已支付到对方账户，但写入本地数据库失败，请与我公司业务人页联系,给您带来不便请谅解";
                }
                else//支付失败时直接显示失败然后返回
                {
                    lblNetPayMent.Text = "网上支付失败。";
                    lblSM.Text = "支付失败，请重新支付。";
                    hlink.NavigateUrl = "../Common/WaitPay.aspx?orderid="+Request["orderid"]+"";
                    hlink.Text = "重新支付订单";
                    return;
                }
            }
            else//支付状态和数据库写入都成功时
            {
                lblNetPayMent.Text = "网上支付成功。";
                lblDB.Text = "数据写入成功。";
                lblSM.Text = "恭喜您支付成功！";
                hlink.NavigateUrl = "~/default.aspx";
                hlink.Text = "返回首页>>";
            }
        }
    }
}
